<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue3响应式原理</title>
</head>
<body>
    
<script>

    let obj = {
        name:'zs',
        age:23,
        height:1.88
    }

    /*
        vue3响应式原理
    */
    const objProxy = new Proxy(obj,{
      get:(target,key,reseiver) => {
        console.log(`${key}被访问了`)
        return target[key]
      },
      set:(target,key,newvalue,reseiver) => {
        console.log(`${newvalue}正在被设置`)
        obj[key] = newvalue
      },
      deleteProperty:(target,key) => {
        console.log(target,key);
        console.log('删除属性')
        delete target[key]
      }
    })

    console.log(objProxy.name);






</script>

</body>
</html>